package org.scc.model;
/**
 * 资源，即页面顶部的菜单，由一级菜单和二级菜单组成
 * 用户控制权限
 * 根据访问的url来判断是否有权限
 * @author rzpeng
 *
 */
public class Resource {
	public static final int LEVEL_FIRST = 1;
	public static final int LEVEL_SECOND = 2;
	
	private int id;
	private String name;
	private String url;
	
	/**
	 * 级别：分为一级菜单和二级菜单,默认为一级菜单
	 */
	private int level = LEVEL_FIRST;
	
	/**
	 * 父资源,只有在是二级菜单的时候才会有该选项
	 */
	private Resource parentRes;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
	public Resource getParentRes() {
		return parentRes;
	}
	public void setParentRes(Resource parentRes) {
		this.parentRes = parentRes;
	}
	public String getLevelText(){
		if(level == LEVEL_FIRST){
			return "一级菜单";
		} else {
			return "二级菜单";
		}
	}
	
}
